﻿using System;

using Client_Web.ServiceReference;

namespace Client_Web
{
    public partial class VoirImage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Visualiser_Click(object sender, EventArgs e)
        {
            ImageCourante.ImageUrl = "Image.aspx?ImageID=" + ImageIDBox.Text;
        }

        protected void Send_Click(object sender, EventArgs e)
        {
            if (ImageFile.HasFile)
                try
                {
                    ServiceClient serviceClient = new ServiceClient();
                    string pictureId = serviceClient.addPicture("39", ImageName.Text, ImageFile.FileBytes);

                    Label1.Text = "pictureId = " + pictureId + " File name: " +
                         ImageFile.PostedFile.FileName + "<br>" +
                         ImageFile.PostedFile.ContentLength + " kb<br>" +
                         "Content type: " +
                         ImageFile.PostedFile.ContentType;
                }
                catch (Exception ex)
                {
                    ErrorL.Text = "ERROR: " + ex.Message.ToString();
                }
            else
            {
                ErrorL.Text = "You have not specified a file.";
            }
            Label1.Text += " File name: " +
        ImageFile.PostedFile.FileName + "<br>" +
        ImageFile.PostedFile.ContentLength + " kb<br>" +
        "Content type: " +
        ImageFile.PostedFile.ContentType;
        }

    }
}